package com.alibaba.middleware.hsf.guide.server;

import com.alibaba.middleware.hsf.guide.api.common.StopGuard;

import com.taobao.hsf.logger.LoggerInit;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author weipeng2k 2017年06月30日 上午11:55:14
 */
public class SpringStart {
    public static void main(String[] args) {
        // 设置project.name，方便在ops系统中查到对应的应用名
        System.setProperty("project.name", "HSF-Guide-Server-Protocol");
        try {
            LoggerInit.changeLogLevel(0);
        } catch (Exception e) {
            e.printStackTrace();
        }


        // 启动Spring容器,获取OrderService这个Bean
        ClassPathXmlApplicationContext application = new ClassPathXmlApplicationContext(
                "classpath:dao.xml", "classpath:datasource.xml", "classpath:biz.xml", "classpath:hsf-provider.xml");
        application.start();
        application.registerShutdownHook();

        // ---------------------- 发布 -----------------------//
        StopGuard.guard();

        // ---------------------- 停止 -----------------------//
        application.close();
    }
}
